package com.example.day45.eventbus;

import android.support.v7.app.AppCompatActivity;
import android.widget.Button;
import android.widget.Toast;

import com.example.day45.R;

import org.androidannotations.annotations.AfterInject;
import org.androidannotations.annotations.Click;
import org.androidannotations.annotations.EActivity;
import org.androidannotations.annotations.ViewById;
import org.simple.eventbus.EventBus;
import org.simple.eventbus.Subscriber;

@EActivity(R.layout.activity_send)
public class SendActivity extends AppCompatActivity {
    EventBus eventBus = EventBus.getDefault();
    @ViewById
    Button sendBtn;

    @AfterInject
    public void init() {
        eventBus.register(this);
    }

    @Click(R.id.send_btn)
    public void onClick() {
//        eventBus.post("雷哥你衣服小了好多!!!");
        eventBus.post("雷哥你憔悴了!!!","1");

//        EventBus.getDefault().post(new Info("我可以告诉你的是,中路以崩盘", "1501"));

    }

    @Subscriber
    public void getData(int index) {
        if (index == 0) {
            Toast.makeText(SendActivity.this, "泉水有妹子", Toast.LENGTH_SHORT).show();
        } else if (index == 1) {
            Toast.makeText(SendActivity.this, "老雷你确实胖了!!!!,真帮不了你!!!", Toast.LENGTH_SHORT).show();
        }
    }


}
